package com.hectopascal;

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

//TIP 要<b>运行</b>代码，请按 <shortcut actionId="Run"/> 或
// 点击装订区域中的 <icon src="AllIcons.Actions.Execute"/> 图标。
public class Main {
    public static int equalSubstring(String s, String t, int maxCost) {
        int max=0,cur=0,cost=0;
        int left=0,right=0;
        while(right<s.length()){
            int chan = Math.abs(s.charAt(right)-t.charAt(right));
            right++;
            cost=chan+cost;
            cur++;
            while(cost>maxCost){
                cost-=Math.abs(s.charAt(left)-t.charAt(left));
                cur--;
                left++;
            }
            max=Math.max(max, cur);
        }
        return max;
    }

    public static void main(String[] args) throws Exception {
        URL url = new URL("https://gkzh-oss.gdash.cn:9443/gdas/cm-h5/views/apps/smart-form/pages/detail/2025/08/21/%E8%B5%84%E4%BA%A7%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF_1755762323557.xlsx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20250821T074523Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3599&X-Amz-Credential=W8IA0tXWzAXDUvlk1h62%2F20250821%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=422b52396d906cc8d0af1d85d2f73640038f46c27683c638710bf445167d1ffe"); // 任意可访问 URL
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");
        InputStream in = conn.getInputStream();
        System.out.println("成功打开流: " + in.available() + " 字节");
        in.close();
    }
}